package VUDUYTUNG;

//import java.io.PrintStream;
import java.util.Scanner;

public class VDT_Test {
	public static void main(String[] args) {
		Double a,b,c;
		Double delta;
		Scanner in = new Scanner(System.in);
		
		//Input value
		System.out.println("Nhap cac gia tri");
		
		//Input a
		do{
		System.out.println("Nhap a = ");
		a=in.nextDouble();
		
		//Input b
		System.out.println("Nhap b = ");
		b=in.nextDouble();
		
		//Input c
		System.out.println("Nhap c = ");
		c=in.nextDouble();
		
		} while(a.isNaN()||b.isNaN()||c.isNaN());
		
		//Delta calculator
		delta=Math.pow(b,2)-4*a*c;
		
		
		if (delta >0)
		{
			System.out.println("Nghiem thu nhat la: " + ((Math.sqrt(delta)-b)/(2*a)));
			System.out.println("Nghiem thu nhat la: " + ((Math.sqrt(delta)+b)/(2*a)));
		}
		else if (delta==0)
		{
			System.out.println("Nghiem thu nhat la: " + ((-b)/(2*a)));
		}
		else if (delta<0)
		{
			System.out.println("Phuong trinh vo nghiem");
		}
		
		
		
	}

}
